// pages/sloper/sloper.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    slope: 0
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
    var that = this
    wx.onAccelerometerChange(function (res) {
      var y = res.y
      var z = res.z
      var slope = Math.atan(y / z) * 180 / Math.PI
      slope = Math.round(slope)
      that.setData({
        slope: slope
      })
    })
  },
})